<template>
	<view>
		<c-type-list :data="videoData" @click="videoInfo" />
		<view v-if="!videoData.length" class="noData">暂无数据</view>
		<uni-load-more v-if="loading" :status="loadStatus"></uni-load-more>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 参数 
				id: '', videoData: [],
				// 加载					加载状态
				loading: false, loadStatus: 'more'
			};
		},
		onPullDownRefresh() { // 下拉刷新
			console.log('下拉')
			this.loading = false
			this.loadStatus = 'more'
			uni.stopPullDownRefresh();
		},
		onPageScroll() { // 滚动监听
			!this.loading && (this.loading = true)
		},
		onReachBottom() { // 上拉加载
			console.log('上拉')
			if (this.loadStatus != '') {
				this.loadStatus = 'loading'
				setTimeout(() => {this.loadStatus = ''}, 1500)
			}
		},
		onLoad(params) {
			if (params.hasOwnProperty('id')) {
				this.id = params.id
				uni.setNavigationBarTitle({ title: params.title })
				this.init()
			}
		},
		methods: {
			// 初始化
			init() {
				this.videoData = [
					{ id: 1, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 2, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 3, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 4, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 5, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 6, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 7, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 8, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 9, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 10, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 11, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 12, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 13, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 14, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 15, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 16, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 17, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 18, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 19, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 20, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' },
					{ id: 21, name: '釜山行2', up: '更新至8集', img: '/static/img/roll/1.jpg' }
				]
			},
			// 详情操作-回调
			videoInfo(row) {
				console.log(row)
			}
		}
	}
</script>

<style lang="scss">
.noData{
	text-align: center;
	margin-top: 100rpx;
	color: $uni-text-color-disable;
}
</style>
